#include <REGX52.H>
#include <INTRINS.H>
void delay(unsigned int x)		//@11.0592MHz
{
	unsigned char i, j;
	while(x--)
	{
		_nop_();
		i = 2;
		j = 199;
		do
		{	
			while (--j);
		} while (--i);
	}
}

void main()
{
	unsigned char lednum=0;//0000 0000
	while(1)
	{
		if(P3_1==0)
		{
			delay(20);
			while(P3_1==0);
			delay(20);
			lednum++;//0000 0001    0000 0010
			P2=~lednum;//1111 1110    1111 1101
		}
	}
}